home *** CD-ROM | disk | FTP | other *** search
- //========================================================================================
- //
- // File: ContainerLink.h
- // Release Version: $ 1.0d11 $
- //
- // Author: Henri Lamiraux
- //
- // Copyright: © 1993, 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef CONTAINERLINK_H
- #define CONTAINERLINK_H
-
- // ----- Part Layer -----
-
- #ifndef FWLINK_H
- #include "FWLink.h"
- #endif
-
- #ifndef FWLNKMGR_H
- #include "FWLnkMgr.h"
- #endif
-
- #ifndef FWPOINT_H
- #include "FWPoint.h"
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma import on
- #endif
- class FW_CLASS_ATTR FW_CPrivOrderedCollection;
- class FW_CLASS_ATTR FW_CFrame;
- class FW_CLASS_ATTR FW_CCloneInfo;
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma import off
- #endif
-
- extern const ODPropertyName kContainerPropSourceLink;
- extern const ODPropertyName kContainerPropDestLink;
- extern const ODValueType kContainerLinkValue;
-
-
- class FW_CLASS_ATTR CBaseShape;
- class FW_CLASS_ATTR CContainerSelection;
- class FW_CLASS_ATTR CContainerPart;
-
- //========================================================================================
- // class CContainerPublishLink
- //========================================================================================
-
- class FW_CLASS_ATTR CContainerPublishLink : public FW_CPublishLink
- {
- public:
- FW_DECLARE_CLASS
-
- CContainerPublishLink(Environment* ev, ODUpdateID updateID,
- FW_CPresentation* presentation,
- CContainerSelection* containerSelection,
- FW_Boolean saveSelection);
- virtual ~ CContainerPublishLink();
-
- virtual void Publish(Environment* ev);
- virtual void ExternalizeLinkContent(Environment* ev, ODStorageUnit* linkSU);
- virtual ODValueType GetPublishFormat(Environment* ev);
-
- FW_Boolean HasEmbeddedFrame(Environment *ev, ODFrame* odFrame);
-
- //--- Will move to FW_CPublishLink
- virtual FW_CFrame* GetFrameToRevealLink(Environment* ev);
- virtual void DoSelect(Environment* ev, FW_CFrame* frame);
-
- void SelectShapes(Environment* ev);
-
- //--- Persistency
- void Externalize(Environment* ev, ODStorageUnit* storageUnit,
- FW_CCloneInfo* cloneInfo);
- void AddShape(Environment* ev, CBaseShape* shape);
-
- private:
- void RestoreContainerSelection(Environment* ev);
-
- private:
- CContainerSelection* fContainerSelection;
- FW_CPrivOrderedCollection* fCollection;
- FW_CPrivOrderedCollection* fSavedSelection;
- };
-
- //========================================================================================
- // class CContainerSubscribeLink
- //========================================================================================
-
- class FW_CLASS_ATTR CContainerSubscribeLink : public FW_CSubscribeLink
- {
- friend class CContainerLinkManager;
-
- public:
- FW_DECLARE_CLASS
-
- CContainerSubscribeLink(Environment* ev, ODLink* odLink,
- FW_CPresentation* presentation,
- CContainerSelection* containerSelection,
- ODLinkInfo* linkInfo);
- virtual ~ CContainerSubscribeLink();
-
- //--- Overrides ---
- virtual void Subscribe(Environment* ev);
- virtual void DoUpdateLink(Environment* ev, ODStorageUnit* linkContentSU);
- virtual void BreakLink(Environment* ev);
-
- private:
- void SaveAndSelectShapes(Environment* ev);
- void RestoreContainerSelection(Environment* ev);
- void SetCollection(Environment* ev);
- void EmptyCollection(Environment* ev);
-
- //--- Persistency
- void Externalize(Environment* ev, ODStorageUnit* storageUnit,
- FW_CCloneInfo* cloneInfo);
- void AddShape(Environment* ev, CBaseShape* shape);
-
- public:
- void SelectShapes(Environment* ev);
- void SetUpdateOffset(Environment* ev, const FW_CPoint& offset);
-
- private:
- CContainerSelection* fContainerSelection;
- FW_CPrivOrderedCollection* fCollection;
- FW_CPrivOrderedCollection* fSavedSelection;
- FW_CPoint fUpdateOffset;
- };
-
- //----------------------------------------------------------------------------------------
- inline void CContainerSubscribeLink::SetUpdateOffset(Environment* ev, const FW_CPoint& offset)
- {
- fUpdateOffset = offset;
- }
-
- //========================================================================================
- // class CContainerLinkManager
- //========================================================================================
-
- class FW_CLASS_ATTR CContainerLinkManager : public FW_CLinkManager
- {
- public:
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
- CContainerLinkManager(Environment* ev, CContainerPart* thePart);
- virtual ~CContainerLinkManager();
-
- //----------------------------------------------------------------------------------------
- // Override Methods
- //
- public:
- virtual FW_CPublishLink* NewPublishLink(Environment* ev,
- ODUpdateID updateID,
- FW_CPresentation* presentation);
- virtual FW_CSubscribeLink* NewSubscribeLink(Environment* ev,
- ODLink* odLink,
- ODLinkInfo* linkInfo,
- FW_CPresentation* presentation);
-
- virtual ODLinkSource* CreateLink(Environment *ev, ODByteArray* data);
-
- virtual void DoChangeLinkStatus(Environment* ev, ODFrame* odFrame);
- // formerly named LinkStatusChanged
-
- virtual void DoUpdateLinks(Environment* ev,
- ODFrame* odEmbeddedFrame,
- ODUpdateID updateID);
- // formerly named EmbeddedFrameUpdated
-
- virtual void RevealLink(Environment* ev, ODLinkSource* linkSource);
-
- //----------------------------------------------------------------------------------------
- // Support for Undo/Redoing PasteAs
- //
- public:
- virtual void UndoPasteAs(Environment* ev, CContainerSubscribeLink* link);
- virtual void RedoPasteAs(Environment* ev, CContainerSubscribeLink* link);
- virtual void CommitUndone(Environment* ev, CContainerSubscribeLink* link);
-
- CContainerSubscribeLink* GetLatestSubscriber(Environment* ev);
-
- void SelectSubscribedShapes(Environment* ev, CContainerSubscribeLink* link);
- void DeleteSubscribedShapes(Environment* ev, CContainerSubscribeLink* link);
-
- //----------------------------------------------------------------------------------------
- // Support for Persistent Links
- //
- public:
- void ExternalizeLinks(Environment* ev, ODStorageUnit* su, FW_CCloneInfo* cloneInfo);
- void InternalizeLinks(Environment* ev, ODStorageUnit* storageUnit);
-
- void RegisterSubscribers(Environment* ev);
-
- private:
- void InternalizeOneDestLink(Environment* ev, ODStorageUnit* storageUnit);
- void InternalizeOneSourceLink(Environment* ev, ODStorageUnit* storageUnit);
-
- ODULong GetSUValue(Environment* ev, ODStorageUnit* su, unsigned long size, void *buffer);
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- private:
- CContainerPart* fContainerPart;
- };
-
- #endif